package com.syp.test.clustercacheflush.service;

import com.syp.test.clustercacheflush.handler.TaskProcessHandler;
import com.syp.test.clustercacheflush.handler.impl.ClusterCacheSyncNotifyHandler;

/**
 * 
 * @author syp
 * @update 2016年7月14日 上午10:05:59
 */
public enum TaskType {

	CLUSTER_CACHE_SYNC_NOTIFY_TASK(1, ClusterCacheSyncNotifyHandler.class, "集群缓存同步通知任务");

	private int type;
	private Class<? extends TaskProcessHandler> executor;
	private String desc;

	private TaskType(Integer type, Class<? extends TaskProcessHandler> executor, String desc) {
		this.type = type;
		this.executor = executor;
		this.desc = desc;
	}

	public Integer getType() {
		return type;
	}

	public Class<? extends TaskProcessHandler> getExecutor() {
		return executor;
	}

	public String getDesc() {
		return desc;
	}

	public static final TaskType get(int type) {
		for (TaskType taskType : TaskType.values()) {
			if (taskType.getType() == type) {
				return taskType;
			}
		}
		return null;
	}

}
